import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger'
import { Logger } from '@nestjs/common';
import { PixivResponse } from '@app/models/models/PixivResponse';
async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.use(function(req,res,next){
    res.removeHeader("X-Powered-By");
    res.header("Server","Apache-Coyote/1.1") /*express*/
    next();
  });
  const config = new DocumentBuilder()
    .setTitle('API Documentation')
    .setVersion('0.0.1')
    .addOAuth2({
      type:"http",
      name:"admin",
      description:"Oauth2"
    })
    .addSecurity("basic",{
      type:'http',
      scheme:'basic'
    })
    .setDescription("Pixiv 逆向API")
    .build();
  const docs = SwaggerModule.createDocument(app,config);
  SwaggerModule.setup('docs-api', app, docs);
  Logger.log(`http://localhost:${3001}/docs-api`,"DOCS");
  let pres:PixivResponse = new PixivResponse();
  console.log(pres)
  await app.listen(3001);

}
bootstrap();
